<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.4.15&key=8bfbfbb89775708dea049f9529649b8c&plugin=AMap.Geocoder"></script>
    <style>
        #container {
            width: 900px;
            height: 500px;
        }
    </style>

</head>
<body>
<div id="container"></div>
<script>

    let map = new AMap.Map("container", {
        resizeEnable: true,
        center: [116.473222, 39.993214],
        zoom: 15
    });

    console.log('map:',map)

    // 创建gps坐标位置点标记
    var lnglat = [116.46706996,39.99188446];
    var m1 = new AMap.Marker({
        position: lnglat,
        icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_r.png"
    });
    map.add(m1);
    m1.setLabel({
        offset: new AMap.Pixel(20, 20),
        content: "GPS 坐标系中首开广场"
    });
    var m2;



    // 坐标转换
    function convertFrom(lnglat, type){
        AMap.convertFrom(lnglat, type, function (status, result) {
            console.log("result:",result.info)
            if (result.info === 'ok') {
                console.log('yes')
                var resLnglat = result.locations[0];
                m2 = new AMap.Marker({
                    position: resLnglat,
                });
                conosle.log("坐标:",resLnglat)
                map.add(m2);
                // 设置标签
                m2.setLabel({
                    offset: new AMap.Pixel(20, 20),
                    content: "高德坐标系中首开广场（正确）"
                });
            }
        });
    }

    convertFrom(lnglat,'gps')
</script>
</body>
</html>